home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7773 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: engnews2.Eng.Sun.COM!positive!linden
  2. From: linden@positive.eng.sun.com (Peter van der Linden)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: malloc() problem
  5. Date: 28 Feb 1996 21:27:09 GMT
  6. Organization: Sun Microsystems Computer Corporation
  7. Message-ID: <4h2hbd$9ra@engnews2.Eng.Sun.COM>
  8. References: <31332992.41C6@mashie.ece.jhu.edu>
  9. NNTP-Posting-Host: positive.eng.sun.com
  10. Cc: 
  11.  
  12. >    Recently I have been haunted by the core dump inside malloc() on SGI
  13. >Indigo2 IRIX5.2, I know the problem is caused by my program not the
  14. >malloc(). But I couldn't find the bug? Does any C expert has identified 
  15. >the common reasons for malloc to core dump? Your help will probably help
  16.  
  17. Your code probably stomped on the malloc structures at some earlier point,
  18. it could be unrelated to what it is doing at the time it coredumps.
  19. This could be as simple as
  20.  
  21.                     a[-1] = ....
  22.  
  23. Check all the dynamic memory you allocate.  Make sure you never write
  24. off the end of what you allocated.
  25.  
  26. -- 
  27. Peter van der Linden     linden@eng.sun.com
  28.    "Dereference misaligned, then cuss.  Cause an error on the bus"
  29.    No, I'm afraid that I'm unable to say that I disapprove of 
  30.    your idea not being cancelled, 
  31.